home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / vidbasic.zip / VCGA.ASM < prev    next >
Assembly Source File  |  1990-11-29  |  5KB  |  159 lines

  1. ;«RM82»«TS8,16,24,32,40,48,56,64»
  2. ; Updated 11/20/90
  3.  
  4. ;============================================================================
  5. ;   Copyright (C) Copr. 1990 by Sidney J. Kelly
  6. ;           All Rights Reserved.
  7. ;           Sidney J. Kelly
  8. ;           150 Woodhaven Drive
  9. ;           Pittsburgh, PA 15228
  10. ;           home phone 412-561-0950 (7pm to 9:30pm EST)
  11. ;============================================================================
  12.  
  13. DOSSEG
  14. .MODEL MEDIUM
  15.     PUBLIC  SNOWCHECK, TOGGLESNOW
  16. .data
  17.     ;external data so all video routines can access
  18.     EVEN
  19.     EXTRN  B$DVIDEOSEG:WORD     ;inside VDATA
  20.     EXTRN  B$DVIDEOPORT:WORD    ;inside VDATA
  21.     EXTRN  B$DVIDEOINSTL:BYTE   ;inside VDATA
  22. .code
  23.  
  24. EXTRN    Get_Adapter:FAR              ;inside VDATA
  25.  
  26. COMPAQ          DB      'COMPAQ'     ; BIOS ID string in COMPAQ's
  27. COMPAQ_LEN      Equ     $-COMPAQ     ; length of string
  28. ZDS        DB    'ZDS CORP'   ; BIOS ID string for Zenith CGA
  29. ZDS_LEN        Equ    $-ZDS        ; length of string
  30.  
  31. EVEN
  32. SNOWCHECK PROC    FAR
  33.  
  34. ;===========================================================================
  35. ; DECLARE SUB SNOWCHECK ()
  36. ; CALL SNOWCHECK
  37. ; Purpose:
  38. ;        Clears the snowcheck variable if find a CGA display by
  39. ;        OLIVETTI (AT&T), COMPAQ, or ZENITH
  40. ;
  41. ; Returns:
  42. ;     Nothing Above Data Area Filed
  43. ;===========================================================================
  44.  
  45.     Push    Bp            ;save everthing we use
  46.         Push    DS
  47.     Push    DI
  48.     Push    SI
  49.  
  50.     Cmp       B$DVIDEOINSTL,1   ;have we done this before?
  51.     JE        Didit             ;yep, so skip ahead
  52.     Call      Get_Adapter       ;determine the display type
  53.  
  54. Didit:
  55.     Cmp       B$DVIDEOPORT,0    ;snowcheck is already set to off
  56.     JE      All_Done          ;so skip ahead
  57.     ;------------------------------------------------
  58.     ;Look for CGA's that do not need snowcheck
  59.     ;------------------------------------------------
  60.  
  61. ATT_test:
  62.          Mov     AX,0F000h     ; Get ROM ID segment
  63.          Mov     ES,AX         ; Store segment in ES
  64.          CLD                   ; clear the direction flag
  65.          Push    DS            ; Save DS
  66.          Mov     AX,CS
  67.          Mov     DS,AX         ; set DS = to CS
  68.  
  69.          Assume  DS:@code
  70.  
  71.                         ; faster version
  72.                         ; Source:  XMS.SYS version 2.06 MASM source
  73.          Cmp     ES:[0C05h],'LO' ; look for byte reversed 'OL' at FC00:0050h
  74.                         ; in memory letters are reversed
  75.         Jne     Compaq_test    ; AT&T not found, test COMPAQ
  76.  
  77. ATT_found:
  78.          ; program assumes that if a CGA is active on an AT&T
  79.         ; that built-in adapter is in use.
  80.  
  81.          Pop     DS             ; restore DS
  82.         Assume  DS:@data
  83.  
  84.     Mov     B$DVIDEOPORT,0
  85.          Jmp     Short All_Done
  86.  
  87. Compaq_test:
  88.          ; Purpose of this test is to allow other routines to know if
  89.          ; "snow" testing is necessary.
  90.  
  91.          Mov     DI,0FFEAh       ; Get ID offset & store in DI
  92.          Mov     SI,OFFSET COMPAQ ; DS:SI points to  "COMPAQ".
  93.          Mov     CX,COMPAQ_LEN   ; CX has length of "COMPAQ".
  94.          REP     CMPSB           ; ES:DI destination, DS:SI source
  95.         JNE     Test_ZDS
  96.  
  97. Compaq_found:
  98.     Pop    DS
  99.         Assume  DS:@data
  100.  
  101.         Mov     B$DVIDEOPORT,0
  102.         Jmp     Short All_Done
  103.  
  104. Test_ZDS:
  105.     Mov     DI, 800Ch
  106.     Mov    SI, OFFSET ZDS
  107.     Mov    CX, ZDS_LEN
  108.     Rep    CMPSB
  109.  
  110.     Pop    DS
  111.         Assume  DS:@data      ;restore DS
  112.  
  113.     Jne    All_Done      ;report ZDS not found
  114.  
  115. ZDS_Found:
  116.         Mov     B$DVIDEOPORT,0
  117.  
  118. All_Done:
  119.     Pop    SI
  120.     Pop    DI
  121.     Pop    DS
  122.         Pop    BP
  123.     Ret
  124. SNOWCHECK ENDP
  125.  
  126. ;===========================================================================
  127. ; DECLARE SUB TOGGLESNOW (Mode%)
  128. ; CALL TOGGLESNOW(Mode%)
  129. ;Input: If Mode% =  0, clears SNOWCHECK
  130. ;       If Mode% <> 0, leaves SNOWCHECK set
  131. ;Purpose:
  132. ;        Clears the snowcheck variable if find a CGA display
  133. ;     Also reinitializes Video Data Area
  134. ;
  135. ;Returns:  Nothing
  136. ;       Video Data Area Filed
  137. ;===========================================================================
  138.  
  139. EVEN
  140. TOGGLESNOW    PROC    FAR
  141.     Push    BP
  142.     Mov    BP,SP
  143.     Call      Get_Adapter       ;determine the display type
  144.                   ;reinitialize each time
  145.     Cmp       B$DVIDEOPORT,0    ;snowcheck is already set to off
  146.                   ;don't want to tinker with this
  147.                   ;if have a MONO, EGA or VGA display
  148.     JE      Finis             ;so skip ahead
  149.     Mov    BX,[BP+6]
  150.     Mov    BX,[BX]          ;get value of toggle
  151.     Or    BX,BX             ;is it zero?, then
  152.     JNZ    Finis          ;nothing to do so skip ahead
  153.     Mov     B$DVIDEOPORT,0      ;else, clear snowcheck variable & quit
  154. Finis:
  155.         Pop    BP
  156.     Ret      2                 ;remove parameters pushed on stack
  157. TOGGLESNOW    ENDP
  158. END
  159.